package com.example.kotlin.scrollingtable.java_type1;

import android.support.annotation.Nullable;
import android.widget.LinearLayout;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.kotlin.scrollingtable.R;
import com.example.kotlin.scrollingtable.type1.model.Type1ProductModel;

/**
 * Created by admin  2019/11/21/18:04
 * Describe
 * 作者 洪亮 admin
 */
public class JavaRvType1LeftAdapter extends BaseQuickAdapter<Type1ProductModel, BaseViewHolder> {

    JavaRvType1LeftAdapter() {
        super(R.layout.item_layout_type1, null);
    }

    @Nullable
    private JavaRvType1RightAdapter rvMainRightAdapter;

    @Nullable
    public  JavaRvType1RightAdapter getRvMainRightAdapter() {
        return this.rvMainRightAdapter;
    }

    public final void setRvMainRightAdapter(@Nullable JavaRvType1RightAdapter adapter) {
        this.rvMainRightAdapter = adapter;
    }

    @Override
    protected void convert(BaseViewHolder helper, Type1ProductModel item) {
        int productPosition = helper.getAdapterPosition();
        if (productPosition == 1) {
            helper.setText(R.id.tv_data, "测试标题");
        } else {
            helper.setText(R.id.tv_data, item.getProductName());
        }
        LinearLayout view = helper.getView(R.id.layout);
        if (helper.getPosition() % 2 == 0) {
            view.setBackgroundColor(mContext.getResources().getColor(R.color.white));
        } else {
            view.setBackgroundColor(mContext.getResources().getColor(R.color.ff_8));
        }
    }
}
